<?php

class m131007_142014_create_file_image_table extends CDbMigration
{
	public function up()
	{
            $this->execute("
                CREATE TABLE IF NOT EXISTS `file_image` (
                    `id` int(11) NOT NULL AUTO_INCREMENT,
                    `url` varchar(255) CHARACTER SET latin1 NOT NULL,
                    `createTime` int(11) NOT NULL,
                    `status` tinyint(4) NOT NULL,
                    `name` varchar(200) CHARACTER SET latin1 NOT NULL,
                    PRIMARY KEY (`id`)
                ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
                
                ALTER TABLE  `product` DROP  `avatar` ;
                ALTER TABLE  `product` DROP  `home` ,
                                    DROP  `feature` ;
                ALTER TABLE  `product` ADD  `priceUnit` VARCHAR( 100 ) NOT NULL AFTER  `price`;
                ALTER TABLE  `product` ADD  `code` VARCHAR( 100 ) NOT NULL AFTER  `content` ,
                                        ADD  `quantity` INT NOT NULL AFTER  `code` ,
                                        ADD  `numSocket` INT NOT NULL AFTER  `quantity`
            ");
	}

	public function down()
	{
		echo "m131007_142014_create_file_image_table does not support migration down.\n";
		return false;
	}

	/*
	// Use safeUp/safeDown to do migration with transaction
	public function safeUp()
	{
	}

	public function safeDown()
	{
	}
	*/
}